import { Module } from "@nestjs/common";
import { MailerModule } from "@nestjs-modules/mailer";
import { HandlebarsAdapter } from "@nestjs-modules/mailer/dist/adapters/handlebars.adapter";
import path from "path";

@Module({
  imports: [
    MailerModule.forRoot({
      transport: "smtps://gaoshunpeng@foxmail.com:hmslskkypcduedej@smtp.qq.com",
      defaults: {
        from: '"高顺鹏" <gaoshunpeng@foxmail.com>',
      },
      template: {
        dir:
          process.env.NODE_ENV === "development"
            ? path.resolve(process.cwd(), "src", "common", "mail", "templates")
            : path.resolve(__dirname, "templates"),
        adapter: new HandlebarsAdapter(),
        options: {
          strict: true,
        },
      },
    }),
  ],
  providers: [],
  controllers: [],
  exports: [],
})
export class MailModule {}
